package com.powernode.factory;

import com.powernode.strategy.LoginStrategy;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * 登录策略工厂类
 *
 * @author ZhangYu
 * @date 2024/12/1 13:56
 */
@Component
public class LoginStrategyFactory {

    @Resource
    private Map<String, LoginStrategy> loginStrategyMap = new HashMap<>();

    /**
     * 根据用户登录类型获取具体的登录策略
     *
     * @param loginType 登录类型
     * @return 登录策略
     */
    public LoginStrategy getInstance(String loginType) {
        return loginStrategyMap.get(loginType);
    }

}
